import Vue from 'vue'
import VueRouter from "vue-router";
Vue.use(VueRouter)

import Layout from '@/views/layout'

import Article from '@/views/article'
import Collect from '@/views/collect'
import Like from '@/views/like'
import User from '@/views/user'
import Detail from '@/views/article-detail'

const router = new VueRouter({
  routes: [
  // 路由重定向
    {
      path: '/',
      redirect:'/article'
    },
    {
      path: '/layout',
      component: Layout,
      children: [
        {
          name:'Article',
          path: '/article',
          component: Article,
        },
        {
          name:'Collect',
          path: '/collect',
          component: Collect,
        },
        {
          name:'Like',
          path: '/like',
          component: Like,
        },
        {
          name:'User',
          path: '/user',
          component: User,
        },
      ]
    },
    {
      name:'Detail',
      path: '/article-detail/:id',
      component: Detail,
    },
  ]
})

export default router